/**
 */
package de.thwildau.tm.moses.thrift.thrift.impl;

import de.thwildau.tm.moses.thrift.thrift.BaseType;
import de.thwildau.tm.moses.thrift.thrift.BaseTypeRef;
import de.thwildau.tm.moses.thrift.thrift.ThriftPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Base Type Ref</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link de.thwildau.tm.moses.thrift.thrift.impl.BaseTypeRefImpl#getBasicType <em>Basic Type</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class BaseTypeRefImpl extends FieldTypeImpl implements BaseTypeRef
{
  /**
   * The default value of the '{@link #getBasicType() <em>Basic Type</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getBasicType()
   * @generated
   * @ordered
   */
  protected static final BaseType BASIC_TYPE_EDEFAULT = BaseType.BOOL;

  /**
   * The cached value of the '{@link #getBasicType() <em>Basic Type</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getBasicType()
   * @generated
   * @ordered
   */
  protected BaseType basicType = BASIC_TYPE_EDEFAULT;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected BaseTypeRefImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return ThriftPackage.Literals.BASE_TYPE_REF;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public BaseType getBasicType()
  {
    return basicType;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setBasicType(BaseType newBasicType)
  {
    BaseType oldBasicType = basicType;
    basicType = newBasicType == null ? BASIC_TYPE_EDEFAULT : newBasicType;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ThriftPackage.BASE_TYPE_REF__BASIC_TYPE, oldBasicType, basicType));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case ThriftPackage.BASE_TYPE_REF__BASIC_TYPE:
        return getBasicType();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case ThriftPackage.BASE_TYPE_REF__BASIC_TYPE:
        setBasicType((BaseType)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case ThriftPackage.BASE_TYPE_REF__BASIC_TYPE:
        setBasicType(BASIC_TYPE_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case ThriftPackage.BASE_TYPE_REF__BASIC_TYPE:
        return basicType != BASIC_TYPE_EDEFAULT;
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (basicType: ");
    result.append(basicType);
    result.append(')');
    return result.toString();
  }

} //BaseTypeRefImpl
